package org.s3.project.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.s3.project.entity.Comment;

import org.s3.project.entity.addComment;
import org.s3.project.mapper.CommentMapper;
import org.s3.project.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author cfx
 * @version 1.0
 * @Description
 * @date 2025/2/9 10:08
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {
    @Autowired
    private CommentMapper commentMapper;

    @Override
    public Boolean insertComments(List<Comment> comment) {
        return commentMapper.insertComments(comment);
    }

    //根据id查询评论
    @Override
    public List<Comment> getCommentById(Integer id) {
        return commentMapper.getCommentById(id);
    }
    /**
     * 评论模糊查询
     * @param Mname 商家名称
     * @param Uname 用户名称
     * @param created_time 创建时间
     * @param create_timeOne 创建时间1
     * @return 查询结果
     */

    @Override
    public List<Comment> selectCommentLike(String Mname,String Uname,String created_time, String create_timeOne) {
        return commentMapper.selectCommentLike(Mname, Uname, created_time, create_timeOne);
    }

    @Override
    public int deleteComment(int id) {
        return commentMapper.deleteComment(id);
    }

    @Override
    public int deleteCommentIds(int[] ids) {
        return commentMapper.deleteCommentIds(ids);
    }


    @Override
    public List<Comment> getCommentByUserId(Integer User_id) {
        return commentMapper.getCommentByUserId(User_id);
    }

    @Override
    public Integer deleteCommentById(Integer id) {
        return commentMapper.deleteById(id);
    }
}
